package test;

import org.springframework.dao.support.DaoSupport;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
import pojo.TbUser;
import service.Impl.UserServiceImpl;
import service.UserService;

import java.util.List;

public class tests extends HibernateDaoSupport {

    public void getUser(TbUser tbUser)
    {
        String hql = "from TbUser where userName = ?0";
        List<TbUser> tbUsers = (List<TbUser>) this.getHibernateTemplate().find(hql, tbUser.getUserName());
        for (int i = 0; i < tbUsers.size(); i++) {
            System.out.println(tbUsers.get(i).toString());
        }

    }

    public static void main(String[] args) {
        UserService userService = new UserServiceImpl();
        TbUser tbUser = new TbUser();
        tbUser.setUserName("1469720568@qq.com");
        tbUser.setUserPassword("yaojin521");
        TbUser login = userService.login(tbUser);
        System.out.println(login);
    }
}
